package com.yyge.controller;

import com.yyge.dto.R;
import com.yyge.util.CommonDataUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 数据字典查询控制器
 */
@Api("数据字典查询控制") //swagger
@RestController
public class DicController {
    //api/dict/bynames?dicts=sex&dicts=status

    @ApiOperation("数据字典查询")
    @GetMapping("/dict/bynames")
    public R findByNameName(String[] dicts){
        Map map=new HashMap(dicts.length*3);
        for (String dict : dicts) {
            List list = CommonDataUtil.findByDictName(dict);
            map.put(dict,list);
        }
      return R.ok(map);
    }
}
